import Vue from 'vue'
import App from './App'
import request from "./static/libs/request";
import config from "./static/libs/config";
import {
	Storage
} from "./static/libs/utils";


Vue.config.productionTip = false

App.mpType = 'app'

const app = new Vue({
    ...App
})
app.$mount()


request.defaults.baseURL = config.url.http + config.path.api;


request.interceptors.request.use((params) => {
	params.data || (params.data = {});
	const authorization = Storage.get("authorization");
	authorization && (params.header.token = authorization);

	for (const key in params.data) {
		if ([undefined, null, NaN].includes(params.data && params.data[key])) {
			delete params?.data[key];
		}
	}
	return params;
});

request.interceptors.response.use(res => res)

Vue.prototype.$config = config;
Vue.prototype.$request = request;

